package com.lebang.feign;

import com.lebang.feign.fallback.SmallAmountWithdrawalFallback;
import com.lebang.model.RequestUserInfo;
import com.lebangweb.response.JsonData;
import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author ljx
 */
@FeignClient(name ="wangzhuan-earns", contextId = "wangzhuan-earns-smallamount",fallback = SmallAmountWithdrawalFallback.class)
public interface SmallAmountWithdrawalFeign {

    /**
     * 是否存在记录
     * @param userInfo
     * @param wxOpenId
     * @return
     */
    @PostMapping("/smallamount/withdrawal/isexists")
    JsonData isExists(@RequestBody RequestUserInfo userInfo,@RequestParam("wxOpenId") String wxOpenId);

    /**
     * 添加记录
     * @param userInfo
     * @param wxOpenId
     * @return
     */
    @PostMapping("/smallamount/withdrawal/addrecord")
    JsonData addrecord(@RequestBody RequestUserInfo userInfo, @RequestParam("wxOpenId") String wxOpenId);

    /**
     * 获取配置
     * @param userInfo
     * @return
     */
    @PostMapping("/smallamount/withdrawal/getconfig")
    JsonData getConfig(@RequestBody RequestUserInfo userInfo,@RequestParam("wxOpenId") String wxOpenId);

    /**
     * 提现
     * @param userInfo
     * @param configId
     * @param wxOpenId
     * @return
     */
    @PostMapping("/smallamount/withdrawal/pull")
    JsonData pull(@RequestBody RequestUserInfo userInfo,
                  @RequestParam("configId") Integer configId,
                  @RequestParam("wxOpenId") String wxOpenId,
                  @RequestParam("phone")String phone,
                  @RequestParam("wxName") String wxName,
                  @RequestParam("ipAddr") String ipAddr);

    /**
     * 记录填充
     */
    @PostMapping("/smallamount/withdrawal/update")
    @ApiOperation("记录填充")
    JsonData update(@RequestBody RequestUserInfo userInfo, @RequestParam("wxOpenId") String wxOpenId,@RequestParam("phone") String phone,@RequestParam("configId") Integer configId);

    /**
     * 是否领取
     */
    @PostMapping("/smallamount/withdrawal/ispull")
    JsonData isPull(@RequestBody RequestUserInfo userInfo, @RequestParam("wxOpenId") String wxOpenid);

    /**
     * 提现金额
     */
    @PostMapping("/smallamount/withdrawal/amount")
    JsonData amount(@RequestBody RequestUserInfo userInfo,
                    @RequestParam("configId") Integer configId,
                    @RequestParam("wxOpenId") String wxOpenId,
                    @RequestParam("phone") String phone);
}
